import { RedisOptions } from 'ioredis';

export interface config {
  // 项目端口
  captcha: {
    default: 'text' | 'math';
    expiresIn: number;
    type: ['text', 'math'];
    prefix: 'captcha:';
  };

  // 应用的访问路径前缀
  contextPath: string;

  crypto: {
    psdSecret: string;
  };

  //接口限流 2分钟内同一个接口允许60次请求
  port: number;

  rateLimit: {
    storage: 'memory' | 'redis';
    ttl: number;
    limit: number;
  };

  redis: RedisOptions;

  strictMode: boolean;
  token: {
    secret: string;
    expiresIn: number;
    prefix: 'token:';
  };

  //是否启用严格模式验证手机号
  upload: {
    path: string;
    config: {
      img: {
        fileSize: number;
        files: number;
        fieldSize: number;
        fields: number;
        fieldNameSize: number;
        parts: number;
        headerPairs: number;
      };
      file: {
        fileSize: number;
        files: number;
        fieldSize: number;
        fields: number;
        fieldNameSize: number;
        parts: number;
        headerPairs: number;
      };
    };
  };
}
